#include <netinet/in.h>
#include <sys/socket.h>

int main()
{
    int listen_fd = socket(PF_INET, SOCK_STREAM, 0);

    struct sockaddr_in address;
    bzero(&address, sizeof(address));

    address.sin_family      = AF_INET;
    address.sin_addr.s_addr = htonl(INADDR_ANY);
    int port                = 1024;
    address.sin_port        = htons(port);

    int flag = 1;
    setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag));

    int ret = bind(listen_fd, (struct sockaddr*)&address, sizeof(address));
    ret     = listen(listen_fd, 5);

    return 0;
}
